<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1" />
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="__TMPL__/public/assets/js/flexible.js" ></script>
		<link rel="stylesheet" href="__TMPL__/public/assets/css/all_page.css" />
		<link rel="stylesheet" href="__TMPL__/public/assets/css/public.css" />
		<style>
			
		</style>
	</head>
	<body>
		
		<div class="evaluate">
			
			<div class="evTop">
				<div class="topTil">
					<p>{$data['name']}</p>
				</div>
				<div class="subTil">{$data['intro']}</div>
			</div>
			
			
			<div class="evCn">
				<div class="evAll">
					<volist name='data_title' id='v' key='k'>
					<div class="evList">
						<div class="evLTop div_float">
							<img src="__TMPL__/public/assets/images/p1.png" />
							<p class="eli_one">{$v['title']}</p>
						</div>
						<div class="evBtm">
							<div class="btml">
								<div class="evRadio radioSel">
									<input type="radio" checked="checked" value="1" name="title[{$k}]" onclick="changeSel($(this))" />
								</div>
								<label>满意</label>
							</div>
							<div class="btml">
								<div class="evRadio">
									<input type="radio" name="title[{$k}]" value="2" onclick="changeSel($(this))" />
								</div>
								<label>基本满意</label>
							</div>
							<div class="btml">
								<div class="evRadio">
									<input type="radio"  name="title[{$k}]" value="3" onclick="changeSel($(this))"  />
								</div>
								<label>不满意</label>
							</div>
						</div>
					</div>
					</volist>
					<!-- <div class="evList">
						<div class="evLTop div_float">
							<img src="__TMPL__/public/assets/images/p1.png" />
							<p class="eli_one">机关大院智能信息化建设管理</p>
						</div>
						<div class="evBtm">
							<div class="btml">
								<div class="evRadio radioSel">
									<input type="radio" checked="checked"  name="jgdy" onclick="changeSel($(this))" />
								</div>
								<label>满意</label>
							</div>
							<div class="btml">
								<div class="evRadio">
									<input type="radio" name="jgdy" onclick="changeSel($(this))" />
								</div>
								<label>基本满意</label>
							</div>
							<div class="btml">
								<div class="evRadio">
									<input type="radio"  name="jgdy" onclick="changeSel($(this))"  />
								</div>
								<label>不满意</label>
							</div>
						</div>
					</div>
					<div class="evList">
						<div class="evLTop div_float">
							<img src="__TMPL__/public/assets/images/p1.png" />
							<p class="eli_one">节能工程整改</p>
						</div>
						<div class="evBtm">
							<div class="btml">
								<div class="evRadio radioSel">
									<input type="radio" checked="checked"  name="jngc" onclick="changeSel($(this))" />
								</div>
								<label>满意</label>
							</div>
							<div class="btml">
								<div class="evRadio">
									<input type="radio" name="jngc" onclick="changeSel($(this))" />
								</div>
								<label>基本满意</label>
							</div>
							<div class="btml">
								<div class="evRadio">
									<input type="radio"  name="jngc" onclick="changeSel($(this))"  />
								</div>
								<label>不满意</label>
							</div>
						</div>
					</div> -->
				</div>
				<div class="evRemark">
					<input  type="hidden" name="quest_id" value="{$data['id']}">
					<input  type="hidden" name="count" value="{:count($data_title)}">
					<textarea name="content" placeholder="请输入您的宝贵意见和建议"></textarea>
					<button class="submitBtn" onclick="sub()">立即提交</button>
				</div>
			</div>
			
			<!--公共底部-->
			<include file='public@footer'/>
			
		</div>
		
	
	<script type="text/javascript" src="__TMPL__/public/assets/js/jquery-1.8.3.js" ></script>
	<script type="text/javascript" src="__TMPL__/public/assets/js/js.js" ></script>
	<script>
		//改变选择的radio 
		function changeSel(pOne){
			pOne.parents('.evRadio').addClass('radioSel')
			pOne.parents('.btml').siblings().find('.evRadio').removeClass('radioSel');
		}
		
		
		function sub() {
			var arr = [];
			var content = $("textarea[name='content']").val();
			var quest_id = $("input[name='quest_id']").val();
			var count = $("input[name='count']").val();
			for (var i = 0; i < count; i++) {
				arr[i] = $("input[name='title["+(i+1)+"]']:checked").val();
			}

			$.ajax({
				url:"{:url('addPost')}",
				data:{
					arr:arr,
					content:content,
					quest_id:quest_id,
				},
				dataType:'json',
				type:'post',
				success:function(data){
					if (data.status == 0) {
		    			alert(data.msg);
		    		}else{
		    			alert(data.msg);
		    			window.location.href=data.url;
		    		}
				},
				error:function(){
					alert("网络异常");
					console.log("网络异常")
				}
			});
			console.log(arr);
		}

	</script>
	</body>
</html>
